
/** 相册权限 */
export enum AlbumAuthority {
  Private = 0, // 私有
  Public = 1, // 公开
  Protected = 2, // 组内公开
}

export type AlbumInfo = {
  uid: string;
  name: string;
  owner: string;
  cover: string;
  tag: string;
  access_permission: AlbumAuthority;
  assets: AssetInfo[];
  remark: string;
  creata_time: string;
  update_time: string;
}

export type AssetInfo = {
  create_time: string;
  name: string;
  remark: string;
  small: string;
  uid: string;
  update_time: string;
  url: string;
}

/** 相册 模型 */
export class AlbumModel {
  private _data = <AlbumInfo>{};


  constructor() { }

  public get data(): AlbumInfo {
    return this._data;
  }
  public setData(data: AlbumInfo): void {
    this._data = data;
  }

  /** 向相册中增加图片资源 */
  public addAlnumAssets(list: AssetInfo[]): void {
    this._data.assets.concat(...list);
  }

  /** 清空相册的资源 */
  public cleanEmptyAlbum(): void {
    this._data.assets = [];
  }
}